<!-- include tpl=header menutitle=$page_rs.title -->
<section class="container"><div class="mt-3"><!-- include tpl=block/breadcrumb --></div></section>
<section class="container">
	<div class="row">
		<div class="col-12 col-lg-3 mb-2">
			<!-- if $session.user_id -->
			<a class="btn btn-primary btn-block mb-2" href="{url ctrl=post id=$page_rs.identifier cateid=$cate_rs.id/}" role="button">
				<i class="fa fa-pencil"></i>
				发布主题
			</a>
			<!-- /if -->
			<!-- subcate pid=$page_rs.id -->
			<div class="card mb-2">
				<div class="card-header">
					栏目
				</div>
				<ul class="list-group list-group-flush">
					<!-- loop from=$list key=$key value=$value id=$tmpid -->
					<li class="list-group-item d-flex justify-content-between align-items-center{if $cate_rs && $cate_rs.id == $value.id} active{/if}">
						<a href="{$value.url}" title="{$value.title}">{$value.title}</a>
						<span class="badge badge-light">
							<!-- php:$total = phpok('_total','pid='.$page_rs.id.'&cateid='.$value.id) -->{$total}
						</span>
					</li>
					<!-- /loop -->
				</ul>
			</div>
		</div>
		<div class="col-12 col-lg-9 mb-2">
			<!-- if !$rslist -->
			<div class="m-4 p-4 text-center">暂无主题</div>
			<!-- else -->
			<!-- include file=bbs_list -->
			<div class="d-none d-md-block mb-2">
			<ul class="nav nav-tabs">
				<li class="nav-item ml-4">
					<a class="nav-link{if !$sort} active{/if}" href="{$cate_rs ? $cate_rs.url : $page_rs.url}">最新回复</a>
				</li>
				<li class="nav-item ml-2">
					<a class="nav-link{if $sort == 'l.hits DESC'} active{/if}" href="{$cate_rs ? $cate_rs.url : $page_rs.url}?sort=l.hits DESC">最多翻阅</a>
				</li>
				<li class="nav-item ml-2">
					<a class="nav-link{if $sort == 'l.hits ASC'} active{/if}" href="{$cate_rs ? $cate_rs.url : $page_rs.url}?sort=l.hits ASC">最少翻阅</a>

				</li>
				<li class="nav-item ml-2">
					<a class="nav-link{if $sort == 'l.dateline DESC'} active{/if}" href="{$cate_rs ? $cate_rs.url : $page_rs.url}?sort=l.dateline DESC">最新主题</a>
				</li>
				<li class="nav-item ml-2">
					<a class="nav-link{if $sort == 'l.dateline ASC'} active{/if}" href="{$cate_rs ? $cate_rs.url : $page_rs.url}?sort=l.dateline ASC">陈年旧贴</a>
				</li>
			</ul>
			</div>
			<div class="list-group mb-2 ">
				<!-- loop from=$rslist key=$key value=$value id=$tmpid -->
				<a href="{$value.url}" class="list-group-item list-group-item-action d-flex justify-content-between">
					
					<img src="{$value._avatar}" class="mr-2 rounded" style="width:50px;height:50px;" alt="{$value._author}" />
					<div class="flex-fill">
						<h5 class="mb-1">{$value.title}</h5>
						<small>{$value._author} 发布于 {func time_format $value.dateline}</small>
						
					</div>
					<!-- if $value._lastdate != time_format($value.dateline) || !$cate_rs -->
					<div>
						<!-- if !$cate_rs && $value.cate && is_array($value.cate) -->
						<small class="badge badge-secondary">{$value.cate.title}</small>
						<!-- /if -->
						<!-- if $value._lastdate != time_format($value.dateline)  -->
						<div><small class="badge badge-light">Last: {$value._lastdate}</small></div>
						<!-- /if -->
					</div>
					<!-- /if -->
					<div class="ml-4"><small class="badge badge-light">{$value.hits}</small></div>
				</a>
				
				<!-- /loop -->
			</div>
			<!-- include tpl=block/pagelist -->
			
			<!-- /if -->
		</div>
	</div>
</section>
<!-- include tpl=footer -->



